package com.itheima.io.inputstream.demo02;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class InputStreamDemo02 {

    public static void main(String[] args) throws IOException {

        InputStream inputStream = new FileInputStream("itheima-io-inputstream\\a.text");

        byte[] bytes = new byte[5];

//        int read = inputStream.read(bytes);
//        while ( read != -1){
//            System.out.print(new String(bytes, 0, read));
//            read = inputStream.read(bytes);
//        }

        int len = -1;
        while ((len = inputStream.read(bytes)) != -1){
            System.out.println(new String(bytes, 0, len));
        }

        inputStream.close();

    }
}
